package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import com.sky.service.AutoFill;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface DishMapper {

    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);

    @AutoFill(OperationType.INSERT)
    void dishAdd(Dish ds);


    Page<DishVO> dishPageAll(String name, Integer categoryId, Integer status);

    void dishDelete(List<Long> ids);

    DishVO dishById(Long id);

    @AutoFill(OperationType.UPDATE)
    void dishUpdate(Dish dish);

    List<DishVO> dishByCateId(Long categoryId);

    List<DishVO> UUdishByCateId(Long categoryId);

    Integer countByMap(Map map);
}
